<!DOCTYPE html>
<html>
<head>
	<title>公众号自定义菜单</title>
	<link rel="stylesheet" type="text/css" href="/Template/admin/default/css/css.css">
	<script type="text/javascript" src="__PUBLIC__/js/jquery-1.9.1.min.js"></script>
	<script type="text/javascript">
		$(document).ready(function(){
			$('#flushBtn').click(function(){
				$('#msg-box').fadeIn(1000);
				$.ajax({
					type:"post",
					url:"{{:U('admin/wechat/creatmenu')}}",
					data:{},
					timeout:10000,
					success:function(val){
						if(val.status){
							$('#msg-box').show().html('菜单已更新').fadeOut(3000);
						}else{
							$('#msg-box').show().html(val.msg);
						}
					},
				});
			});
		});
	</script>
</head>
<body>
<div class="content">
	<div class="curr-position">当前位置：自定义菜单</div>
	<div class="page-top">
		<span class="fl"><a href="{{:U('admin/wechat/config')}}">公众号设置</a> | <a href="{{:U('admin/wechat/wechatbtn')}}">自定义菜单</a> | <a href="{{:U('admin/wechat/insertbtn')}}">增加菜单</a> 【 <a id="flushBtn" href="javascript:;">更新微信菜单</a>】<span id="msg-box">正在同步……</span></span>
		<span class="fr"><a href="javascript:location.reload();">刷新</a></span>
	</div>

	<table class="data-tab">
		<thead>
			<tr>
				<th class="id">ID</th>
				<th>名称</th>
				<th>类型</th>
				<th>子菜单</th>
				<th>CLICK</th>
				<th>URL</th>
				<th>状态</th>
				<th class="operation">操作</th>
			</tr>
		</thead>
		<tbody>
		<volist name="btntop" id="vo">
			<tr>
				<td class="id">{{$vo.id}}</td>
				<td>{{$vo.name}}</td>
				<td><if condition="$vo[type] eq 0">CLICK点击<else/>VIEW路径</if></td>
				<td>{{$vo.sub}}</td>
				<td>{{$vo.click|default='----'}}</td>
				<td>{{$vo.url|default='----'}}</td>
				<td>
					<if condition="$vo[status] eq 0">
						<span class="disabled">已禁用</span>
					<else />
						<span class="available">已启用</span>
					</if>
				</td>
				
				<td>
					<if condition="$vo[status] eq 0">
						<a href="{{:U('admin/wechat/status',array('id'=>$vo[id],'op'=>1))}}">启用</a>
					<else />
						<a href="{{:U('admin/wechat/status',array('id'=>$vo[id],'op'=>0))}}">禁用</a>
					</if>
				 <a href="{{:U('admin/wechat/editbtn',array('id'=>$vo[id]))}}">编辑</a> <a href="{{:U('admin/wechat/deletebtn',array('id'=>$vo[id]))}}">删除</a>
				 </td>
			</tr>
			<volist name="btnson" id="voo">
			<if condition="$voo[pid] eq $vo[id]">
			<tr>
				<td class="id">{{$voo.id}}</td>
				<td>+-----{{$voo.name}}</td>
				<td><if condition="$voo[type] eq 0">CLICK点击<else/>VIEW路径</if></td>
				<td>{{$voo.sub}}</td>
				<td>{{$voo.click|default='----'}}</td>
				<td>{{$voo.url|default='----'}}</td>
				<td>
					<if condition="$voo[status] eq 0">
						<span class="disabled">已禁用</span>
					<else />
						<span class="available">已启用</span>
					</if>
				</td>
				
				<td>
					<if condition="$voo[status] eq 0">
						<a href="{{:U('admin/wechat/status',array('id'=>$voo[id],'op'=>1))}}">启用</a>
					<else />
						<a href="{{:U('admin/wechat/status',array('id'=>$voo[id],'op'=>0))}}">禁用</a>
					</if>
				 <a href="{{:U('admin/wechat/editbtn',array('id'=>$voo[id]))}}">编辑</a> <a href="{{:U('admin/wechat/deletebtn',array('id'=>$voo[id]))}}">删除</a>
				 </td>
			</tr>
			</if>
		</volist>
		</volist>
		</tbody>
	</table>
	<div class="pagenation">{{$page}}</div>

</div>

</body>
</html>